package com.xs.ai.entity;

import jakarta.persistence.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import org.hibernate.annotations.Type;
import com.vladmihalcea.hibernate.type.json.JsonType;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

// ==========================================
// 每日简报实体
// ==========================================
@Data
@Entity
@Table(name = "daily_briefings",
       uniqueConstraints = @UniqueConstraint(columnNames = {"userId", "briefingDate"}))
public class DailyBriefing {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    private Long userId;
    private LocalDate briefingDate;
    
    @Type(JsonType.class)
    @Column(columnDefinition = "jsonb")
    private Map<String, Object> topEmailsSummary;
    
    @Type(JsonType.class)
    @Column(columnDefinition = "jsonb")
    private Map<String, Object> meetingsSummary;
    
    @Type(JsonType.class)
    @Column(columnDefinition = "jsonb")
    private Map<String, Object> pendingDecisions;
    
    @Type(JsonType.class)
    @Column(columnDefinition = "jsonb")
    private Map<String, Object> keyMetrics;
    
    @Type(JsonType.class)
    @Column(columnDefinition = "jsonb")
    private List<String> aiRecommendations;
    
    private LocalDateTime generatedAt;
    private LocalDateTime deliveredAt;
    private LocalDateTime userViewedAt;
}